package cn.tedu.boyou.acticle.domain;

import cn.tedu.boyou.common.domain.BaseDomain;
import cn.tedu.boyou.member.domain.UserInfo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
@Getter
@Setter
@ToString
public class Answering extends BaseDomain{
    //未回答状态
    public static final int STATE_UNANSWERED = 0;
    //已回答状态
    public static final int STATE_ANSWERED = 1;

    //最热门的问答类型
    public static final int TYPE_HOT = 0;
    //最新的问答类型
    public static final int TYPE_NEWEST = 1;
    //待回答的类型
    public static final int TYPE_UNANSWERED = 2;



    private UserInfo author; //问题的作者
    private Destination dest; //目的地
    private String tags; //旅游标签
    private String title;   //问题的标题
    private String content; //问题的内容
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createTime;    //创建的时间
    private int viewnum = 0; //评论数
    private int replynum = 0; //评论数
    private int thumbsupnum = 0; //点赞数
    private int state = STATE_UNANSWERED; //状态
    private int type; //问题的类型
    private int isanonymity = 0; //是否匿名 默认不匿名


    public String getStateDisplay(){
        if (state ==STATE_UNANSWERED ){
            return "未回答";
        }else if(state ==STATE_ANSWERED ){
            return "已回答";
        }
        return "";
    }
}
